home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1998 July / EnigmA AMIGA RUN 29 (1998)(G.R. Edizioni)(IT)[!][issue 1998-07 & 08].iso / recent / create.lha / Convert2PNG.isrx < prev    next >
Text File  |  1997-11-19  |  3KB  |  108 lines

  1. /* ImageStudio ARexx script **************************************/
  2.  
  3. /* Allow commands to return results */
  4.  
  5. options results
  6.  
  7. /* On error, goto ERROR:. Comment out this line if you wish to */
  8. /* perform your own error checking. */
  9.  
  10. signal on error
  11.  
  12. /* BEGIN PROGRAM *************************************************/
  13.  
  14. /* Warn the user if they are about to overwrite their current project */
  15.  
  16. IMAGEINFO_GET STEM imageinfo.
  17.  
  18. if imageinfo.changed == 1 then
  19.    REQUEST_MESSAGE TEXT '"Project has changed, continue?"',
  20.       BUTTONTEXT '"OK|Cancel"' AUTOCANCEL
  21.  
  22. /* get src files */
  23. REQUEST_MULTIFILE TITLE '"Choose source files..."' STEM srcfiles.
  24.  
  25. /* Loop around and convert all the files */
  26.  
  27. do l = 0 to (srcfiles.files.count - 1)
  28.    /* Open the file */
  29.  
  30.    OPEN FILE '"'srcfiles.files.l'"' FORCE
  31.  
  32.    /* Create the output filename */
  33.  
  34.    FILE_SPLIT FILE '"'srcfiles.files.l'"' STEM filesplit.
  35.  
  36.    filename=left(filesplit.filepart,index(filesplit.filepart,'.')-1)
  37.  
  38.    FILE_JOIN PATHPART '"'filesplit.pathpart'"',
  39.       FILEPART '"'filename'.png"' VAR 'destfile'
  40.  
  41.    /* Save the fileout in the new format */
  42.  
  43.    SAVE FILE '"'destfile'"' FORMAT 'PNG' FORCE
  44.  
  45. end
  46.  
  47.  
  48. /* END PROGRAM ***************************************************/
  49.  
  50. exit
  51.  
  52. /* On ERROR */
  53.  
  54. ERROR:
  55.  
  56. /* If we get here, either an error occurred with the command's */
  57. /* execution or there was an error with the command itself. */
  58. /* In the former case, rc2 contains the error message and in */
  59. /* the latter, rc2 contains an error number. SIGL contains */
  60. /* the line number of the command which caused the jump */
  61. /* to ERROR: */
  62.  
  63. if datatype(rc2,'NUMERIC') == 1 then do
  64.    /* See if we can describe the error with a string */
  65.  
  66.    select
  67.       when rc2 == 103 then
  68.          err_string = "ERROR 103, "||,
  69.             "out of memory at line "||SIGL
  70.       when rc2 == 114 then
  71.          err_string = "ERROR 114, "||,
  72.             "bad command template at line "||SIGL
  73.       when rc2 == 115 then
  74.          err_string = "ERROR 115, "||,
  75.             "bad number for /N argument at line "||SIGL
  76.       when rc2 == 116 then
  77.          err_string = "ERROR 116, "||,
  78.             "required argument missing at line "||SIGL
  79.       when rc2 == 117 then
  80.          err_string = "ERROR 117, "||,
  81.             "value after keywork missing at line "||SIGL
  82.       when rc2 == 118 then
  83.          err_string = "ERROR 118, "||,
  84.             "wrong number of arguments at line "||SIGL
  85.       when rc2 == 119 then
  86.          err_string = "ERROR 119, "||,
  87.             "unmatched quotes at line "||SIGL
  88.       when rc2 == 120 then
  89.          err_string = "ERROR 120, "||,
  90.             "line too long at line "||SIGL
  91.       when rc2 == 236 then
  92.          err_string = "ERROR 236, "||,
  93.             "unknown command at line "||SIGL
  94.       otherwise
  95.          err_string = "ERROR "||rc2||", at line "||SIGL
  96.       end
  97.         end
  98. else if rc2 == 'RC2' then do
  99.    err_string = "ERROR in command at line "||SIGL
  100.    end
  101. else do
  102.         err_string = rc2||", line "||SIGL
  103.         end
  104.  
  105. request_message TEXT '"'err_string'"'
  106.  
  107. exit
  108.